package com.haoyun.mirage.auth.client.fallback;

import com.haoyun.common.core.Result;
import com.haoyun.mirage.auth.client.UserServiceClient;
import com.haoyun.mirage.auth.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;


/**
 * Created by twg on 2018/3/8.
 */
@Slf4j
@Component
public class UserServiceClientFallBack implements UserServiceClient {

    @Override
    public Result<String> createUser(UserVO user) {
        log.info("this is createUser");
        return Result.buildErrorResult(00011, "创建用户失败！");
    }

    @Override
    public UserVO getUserByName(@PathVariable("username") String username) {
        log.info("this is getUserByName by {}", username);
        UserVO userVO = new UserVO();
        userVO.setUserName(username);
        return userVO;
    }

    @Override
    public UserVO getUserRolesByName(@PathVariable("username") String username) {
        UserVO userVO = new UserVO();
        userVO.setUserName(username);
        return userVO;
    }
}
